<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商户登录</title>
<link href="${ctx }/style/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${ctx }/js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="${ctx }/js/common.js"></script>

<script type="text/javascript">

function m_checkLogin()
{
  var username = $("#m_j_username").val();
  if(username == ""){
		alert("请填写申请人用户名。");
		$("#m_j_username").focus();
		return false;
  }

  var j_password = $("#m_j_password").val();
  if(j_password == ""){
	  alert("请填写密码。");
	  $("#m_j_password").focus();
      return false;
  }

  var _captcha_parameter = $("#m_captcha_parameter").val();
  if(_captcha_parameter == ""){
	  alert("请填写验证码。");
	  $("#m_captcha_parameter").focus();
      return false;
  }

  if($("#cb_SaveName").attr("checked")==true){
	  setCookie("kg_username",username,7*24*3600,null,"/",true);
  }
	  
  $("#m_loginForm").submit();
}

	/***** 忘记密码 ******/
	function forgetpwd(){
		var u_name = $("#m_j_username").val();
		  if(u_name == ""){
				alert("请填写申请人用户名。");
				$("#m_j_username").focus();
				return false;
		  }
		location.href = "${ctx }/customer/forgetpwd.do?userType=2&u_name="+u_name;
	}

	function refreshImage()
	{
		var m_imgObj = document.getElementById("m_captcha");
		m_imgObj.src = "${ctx}/servlet/captcha.jpg?" + new Date().getTime();
	}

	function init_message(){

		var errorMessage = '${requestScope.errormessge}';

		if(errorMessage != ''){
			alert(errorMessage);
		}
	}

	$(function(){
		var uName = getCookie("kg_username");
		$("#m_j_username").val(uName);
		init_message();
	});
	
</script>

<style TYPE="text/css">
#main{margin: 0 auto;width: 960px;height: 400px;background: url("${ctx}/images/login/background.jpg");overflow: auto;border: 1px solid #ccc;margin-top: 5px;}
#content{margin: 30px 0px 0px 30px;}
.bt14A {font-size: 14px;line-height: 25px;color: #666666;padding: 5px 5px 5px 5px;}
.input{border: 1px solid #cccccc;-moz-border-radius: 3px;-webkit-border-radius: 3px;height: 18px;line-height: 17px;padding: 8px 5px 7px;width: 200px;font-size: 14px;}
</style>

</head>

<body>

<%@include file="/commons/head.jsp"%>

<div id="main">

    <div style="margin: 40px 0px 0px 75px;">
		<span><img src="${ctx}/images/login/login.jpg"/></span>
    </div>
	<div id="content">
		<form action="${ctx }/member/login.do" method="post" name="loginForm" id="m_loginForm" style="margin: 0;padding: 0">
			<table border="0" cellpadding="3" cellspacing="5" width="100%">
			  <tr>
			    <td class="bt14A" align="right">商户名称</td>
			    <td><input type="text" name="j_username" id="m_j_username" class="input"></td>
			  </tr>
			  <tr>
				  <td class="bt14A" align="right">密码</td>
				  <td>
					  <div style="float: left;">
					  	<input type="password" name="j_password" id="m_j_password" class="input">
					  </div>
					  <div style="padding: 10px 0px 0px 10px;float: left;font-size: 12px;color: #666666;">
			      		<a href="javascript:forgetpwd()">忘记密码？</a>
			    	  </div>
			      </td>
			  </tr>
			  <tr>
				<td style="font-family: 宋体;font-size: 14px;color: #666666;" align="right">验证码</td>
				<td style="font-family: 宋体;font-size: 14px;">
					<div style="float: left;">
						<input type="text" name="_captcha_parameter" id="m_captcha_parameter" size="8" class="input"/>
					</div>
					<div style="padding: 10px 0px 0px 10px;float: left;">
						<img id="m_captcha" src="${ctx }/servlet/captcha.jpg" title="点击刷新图片" alt="点击刷新图片"
							onclick="javascript:refreshImage();" style="cursor: pointer; border: 0px;vertical-align: middle;"/>
						<a href="javascript:refreshImage();"><span style="font-size: 12px;color: #666666;">换一张图</span></a>
					</div>
					</td>
			  </tr>
			  <tr><td></td>
				  <td>
					   <div style="padding-top: 0px;height: auto;line-height: 20px;color: #999;font-size: 12px;float: left;">
					  	 <input id="cb_SaveName" type="checkbox" name="cb_SaveName" checked="checked">
					   </div>
					    <div style="padding-top: 0px;height: auto;line-height: 20px;color: #666666;font-size: 12px;float: left;">
					  	   记住账号
					   </div>
				   </td>
			  </tr>
			  <tr>
				    <td width="150"></td>
				    <td>
				    	<div style="float: left;">
				     		<input type="button" value="登 录" onclick="javascript:m_checkLogin();" class="btn_login"/> 
				     	</div>
					     <div style="float: left;padding-left: 50px;height: 34px;line-height: 34px;">
					     	<a href="${ctx }/member/register.jsp" style="color: blue">新商户注册</a>
					     </div>
				    </td>
			  </tr>
			</table>
	 </form>
	</div>
</div>

<%@include file="/commons/foot.jsp"%>

</body>
</html>